Jaccard
Implements the Jaccard index, also known as the Jaccard similarity coefficient (Jaccard, 1912).
Each input string is converted into a set of n-grams, the Jaccard index is then computed as \(\frac{\lVert V_1 \cap V_2 \rVert}{\lVert V_1 \cup V_2 \rVert}\). Like Q-Gram distance, the input strings \(X\) and \(Y\) are first converted into sets of n-grams \(V_1\) and \(V_2\) (sequences of n characters, also called k-shingles), but this time the cardinality of each n-gram is not taken into account.
The distance is computed as \(1 - similarity(X, Y)\).
References
Jaccard, P. (1912-02). The distribution of the flora in the alpine zone. New Phytologist, 11(2), 37–50. https://doi.org/10.1111/j.1469-8137.1912.tb05611.x[sci-hub]
Author
Thibault Debatty, solonovamax
See also
Functions
Compute and return the profile of s, as defined by Ukkonen (Ukkonen 1992). The profile is the number of occurrences of k-shingles, and is used to compute q-gram similarity, Jaccard index, etc. Pay attention: the memory requirement of the profile can be up to \(k \times \text{size of the string}\)